package servlet.admin.passage;

import service.PassageService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet( name = "AdminPassageUpdateServlet")
public class AdminPassageUpdateServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PassageService service=new PassageService();

        Integer passageId=Integer.parseInt(request.getParameter("passageId"));
        String content=request.getParameter("content");
        String roof=request.getParameter("roof");

        service.passageUpdate(passageId,content,roof);

        request.getServletContext().getRequestDispatcher("/admin/AdminAllPassageServlet").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
